<template>
    <div class="load-card" v-motion-slide-top>
        <img :src="proxy.globalInfo.imageUrl + props.cardObj.cover" alt="" @click="toRouter">
        <div class="l-content">
            <div class="l-name" @click="toRouter">{{ props.cardObj.name }}</div>
            <div class="l-tips">{{ props.cardObj.tips }}</div>
            <div class="l-num">文章:&nbsp;&nbsp;{{ props.cardObj.blogNum }}篇</div>
        </div>
    </div>
</template>

<script setup>
import { getCurrentInstance } from 'vue'
import { useRouter } from 'vue-router';
const router = useRouter();
const { proxy } = getCurrentInstance();
const props = defineProps({
    cardObj: {
        type: Object,
        required: true
    }
})

const toRouter = () => {
    router.push({path: props.cardObj.url})
}
</script>

<style lang="scss" scoped>
.load-card {
    width: calc((100% - 80px) / 4);
    height: 120px;
    margin-right: 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    border: 1px solid #f0f0f0;
    box-sizing: border-box;
    padding: 10px;
    color: rgba(0, 0, 0, 0.85);
    font-size: 14px;
    font-variant: tabular-nums;
    line-height: 1.5715;
    list-style: none;
    font-feature-settings: 'tnum';
    position: relative;
    background: #fff;
    border-radius: 2px;

    img {
        width: 100px;
        height: 100px;
        border-radius: 4px;
        margin-right: 10px;
    }

    .l-content {
        height: 100%;
        padding: 4px 0;
        display: flex;
        flex-direction: column;
        justify-content: space-between;

        .l-name {
            color: $font-color-primary;
            cursor: pointer;
        }

        .l-num {
            font-size: 12px;
            color: #919da9;
        }
    }
}
</style>